package com.songlanyun.modules.config.controller.admin;

import com.songlanyun.common.annotation.RepeatSubmit;
import com.songlanyun.common.annotation.SysLog;
import com.songlanyun.common.utils.R;
import com.songlanyun.common.validator.ValidatorUtils;
import com.songlanyun.modules.config.entity.YxtTeamRewardConfig;
import com.songlanyun.modules.config.entity.YxtUserTeamRateConfig;
import com.songlanyun.modules.config.service.otherStoreManagerRewardConfigService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 其他店长奖励配置表
 */
@RestController
@RequestMapping("admin/otherStoreManagerReward/config")
public class OtherStoreManagerRewardConfigAdminController {
    @Autowired
    private otherStoreManagerRewardConfigService otherStoreManagerRewardConfigService;


    /**
     * 其他用户奖励配置
     */
    @GetMapping("/info")
    public R info() {
        List<YxtUserTeamRateConfig> YxtUserTeamRateConfigList = otherStoreManagerRewardConfigService.get();
        return R.ok().put("data", YxtUserTeamRateConfigList);
    }

    /**
     * 保存其他用户奖励配置
     */
    @SysLog("保存其他用户奖励配置")
    @PostMapping("/save")
    public R save(@RequestBody YxtUserTeamRateConfig yxtUserTeamRateConfig) {
        ValidatorUtils.validateEntity(yxtUserTeamRateConfig);
        otherStoreManagerRewardConfigService.saveOtherStoreManagerRewardConfig(yxtUserTeamRateConfig);
        return R.ok();
    }


}
